BOD Properties tab - Constraints sub-tab

A property constraint is a business rule that is applied to a single property within an object.

By default, the BOD Constraints sub-tab is found in the following location:

■    Tools > Business object designer, then from the toolbar choose New > Design Business Definition (or select an existing object, then from the toolbar choose Edit), select the Properties tab, then select the Constraints sub-tab.

Constraints

Lists the constraints that already exist for this property or says “New” if none already exist. With New selected, the object’s designer is able to create a new constraint for the property. If an existing constraint is selected, its details are shown below and may be edited, or it can be deleted by clicking Remove to the right of the list.

Name

The name of the constraint being created or edited.

Caution! Do not use SQL Server reserved keywords as the name of constraints.

Active

Indicates whether the constraint should be run or is temporarily disabled. If checked, the constraint runs. If unchecked, it does not run but the code and other settings on this screen remain a part of the object’s design.

Severity

Indicates what happens if the constraint fails. Possible choices are:

■    Warning - The end user is shown a warning message but the object is allowed to save/be updated.

■    Error - The end user is shown a user error message and the object cannot be saved/updated until the error is resolved.

■    System Error - The end user is shown a system error message and the object cannot be saved/updated until the error is resolved.

Message

The warning or error message to display if the constraint fails. If no message is entered, a default warning or error message appears.

Description

Allows the object’s designer to enter a text description of the purpose of the constraint. This is for documentation purposes only.

Code

Allows the object’s designer to enter the C# code that determines if the property’s value passes the constraint (that is, if the value is valid). The code should be written to set the value of the constraintPassed variable appropriately: to True if the constraint passed or False if it did not, or the reverse if Acceptance is unchecked.